'use strict';

module.exports = app => {
  const { INTEGER, DATE, STRING, NOW } = app.Sequelize;
  const Category = app.model.define('category', {
    category_id: {
      type: INTEGER,
      primaryKey: true,
      unique: true,
      autoIncrement: true,
    },
    category_name: {
      type: STRING,
      allowNull: false,
      defaultValue: '',
    },
    category_cover: {
      type: STRING,
      defaultValue: '',
    },
    description: {
      type: STRING,
      defaultValue: '',
    },
    keyword: {
      type: STRING,
      defaultValue: '',
    },
    pid: {
      type: STRING,
      defaultValue: 0,
    },
    is_page: {
      type: INTEGER,
      defaultValue: 1,
      allowNull: false,
    },
    created_at: {
      type: DATE,
      defaultValue: NOW,
    },
    update_at: {
      type: DATE,
      defaultValue: NOW,
    },
  }, {
    timestamps: false,
    tableName: 'l_category',
  })
  return Category;
}
